﻿using APP.HELPER.Data.Helper;
using System; using Extra.ERP;
using System.ComponentModel;
using System.Data.SqlClient;

namespace HRM.CORE
{
    public class HRM_CANDIDATE_DEGREE
    {
        private string m_CandidateCode;
        private string m_DegreeCode;

        public HRM_CANDIDATE_DEGREE()
        {
            this.m_CandidateCode = "";
            this.m_DegreeCode = "";
        }

        public HRM_CANDIDATE_DEGREE(string CandidateCode, string DegreeCode)
        {
            this.m_CandidateCode = CandidateCode;
            this.m_DegreeCode = DegreeCode;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { this.m_CandidateCode, this.m_DegreeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_CANDIDATE_DEGREE_Delete", myParams, myValues);
        }

        public string Delete(string CandidateCode, string DegreeCode)
        {
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { CandidateCode, DegreeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_CANDIDATE_DEGREE_Delete", myParams, myValues);
        }

        public bool Exist(string CandidateCode, string DegreeCode)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { CandidateCode, DegreeCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_CANDIDATE_DEGREE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(string CandidateCode, string DegreeCode)
        {
            string str = "";
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { CandidateCode, DegreeCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_CANDIDATE_DEGREE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_CandidateCode = Convert.ToString(reader["CandidateCode"]);
                    this.m_DegreeCode = Convert.ToString(reader["DegreeCode"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { this.m_CandidateCode, this.m_DegreeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_CANDIDATE_DEGREE_Insert", myParams, myValues);
        }

        public string Insert(string CandidateCode, string DegreeCode)
        {
            string[] myParams = new string[] { "@CandidateCode", "@DegreeCode" };
            object[] myValues = new object[] { CandidateCode, DegreeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_CANDIDATE_DEGREE_Insert", myParams, myValues);
        }

        [DisplayName("CandidateCode"), Category("Column")]
        public string CandidateCode
        {
            get
            {
                return this.m_CandidateCode;
            }
            set
            {
                this.m_CandidateCode = value;
            }
        }

        [DisplayName("DegreeCode"), Category("Column")]
        public string DegreeCode
        {
            get
            {
                return this.m_DegreeCode;
            }
            set
            {
                this.m_DegreeCode = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_CANDIDATE_DEGREE";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }
    }
}

